#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

void swap_element(int[], int);
void quick_sort(int[], int);
void print_array(int[], int);
void print_median(int[], int);

int main()
{
    int num;
    while (scanf("%d", &num) != EOF) {
        if (num == 0) 
            break;
        
        int* num_list = (int*)malloc(num * sizeof(int));
        for (int i = 0; i < num; i++)
            scanf(" %d", num_list + i);

        quick_sort(num_list, num);
        print_median(num_list, num);
        // print_array(num_list, num);
    }
}

void swap_element(int array[], int i, int j)
{
    int temp;
    temp = array[i];
    array[i] = array[j];
    array[j] = temp;
}

void quick_sort(int array[], int num)
{
    int i, last = 0;
    if (num <= 1)
        return;
    swap_element(array, 0, rand() % num);
    for (i = 1; i < num; i++) {
        if (array[i] < array[0])
            swap_element(array, ++last, i);
    }

    swap_element(array, 0, last);
    quick_sort(array, last);
    quick_sort(array + last + 1, num - last - 1);
}

void print_array(int array[], int num)
{
    for (int i = 0; i < num; i++)
        printf("%d ", array[i]);
    printf("\n");
}

void print_median(int array[], int num)
{
    int median;
    if (num % 2 != 0)
        printf("%d\n", array[(num - 1) / 2]);
    else {
        median = (int)floor(((double)array[num / 2] + (double)array[num / 2 - 1]) / 2);
        printf("%d\n", median);
    }
}
